# 正推
def add():
    music = float(input("输入定数："))
    score = float(input("输入分数："))
    print("当前曲目计算ptt:", end = "")
    if score >= 10000000 :
        print(f"{music + 2:.1f}")
    elif score >= 9800000 :
        print(f"{music + 1 + (score - 9800000)/200000:.4f}")
    elif score > 0 :
        print(f"{music + (score - 9500000)/300000:.4f}")
    
# 逆推
def sub():
    music = float(input("输入定数："))
    end = float(input("输入预期潜力值："))
    print("当前曲目需要:", end = "")
    if end - music >= 2 :
        print("10,000,000 +")
    elif end - music >= 1 :
        print(f"{int((end - music - 1) * 200000 + 9800000)}")
    else :
        print(f"{int((end - music) * 300000 + 9500000)}")

# 计算平均PPT
def ppt():
    b30 = float(input("输入B30："))
    r10 = float(input("输入R10："))
    print(f"当前实际PTT为：{(b30 * 30 + r10 * 10) / 40:.4f}")

# 计算所有使得铺面得分大于EX分数Far和Lost的所有组合
def fal():
    block = int(input("输入物量："))
    end = int(input("所需分数(必须大于EX分)："))
    small = int(input("小P数："))
    end += small
    if end < 9800000 :
        return print("分数太低不予计算")
    f = 0
    score = float(10000000.0000 / float(block))
    while(True):
        print(f"-----------------\nFar = {f}")
        if (10000000 - (score * f / 2) < end):
            break
        l = 0
        while(True) :
            if (10000000 - (score * f / 2) - (score * l) < end):
                break
            print(f"Far：{f}, Lost：{l}, 分数：{int(10000000 - (score * f / 2) - (score * l))}")
            l += 1
        f += 1
                
    
print("选择功能：\n1. 正推 定数+分数->结果ppt\n2. 逆推 定数+结果ptt->所需分数\n3. 计算实际PTT\n4. Far与Lost最大组合")
choose = int(input())
if (choose == 1):
    add()
elif (choose == 2):
    sub()
elif (choose == 3):
    ppt()
else :
    fal()